package com.zyf.apitest.source;

import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * @author Malegod_xiaofei
 * @create 2021-12-25-21:14
 */
public class SourceTest2_File {
    public static void main(String[] args) throws Exception {
        // 创建执行环境
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        // 设置并行度
        env.setParallelism(1);

        // 从文件读取数据
        DataStream<String> dataStream = env.readTextFile("D:\\Code\\IDEA-Project\\FlinkTutorial\\src\\main\\resources\\sensor.txt");

        // 打印输出
        dataStream.print("test");

        // 执行
        env.execute();

    }
}
